package com.culturalCenter.dataCenter.mapper.training;

import com.culturalCenter.dataCenter.customEntity.training.CustomTrainingInfoStatistics;
import com.culturalCenter.dataCenter.entity.training.TrainingAudienceCount;
import com.culturalCenter.dataCenter.mapper.base.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * 培训受众分析统计(TrainingAudienceCount)表数据库访问层
 *
 * @author makejava
 * @since 2020-09-22 19:24:39
 */
@Mapper
public interface TrainingAudienceCountMapper extends BaseMapper<TrainingAudienceCount> {

    /**
     * 通过主键删除数据
     *
     * @param id 主键
     *
     * @return 影响行数
     */
    int deleteById(@Param("id") String id);

    /**
     * 报名中的性别比例
     *
     * @param trainingId
     *
     * @return
     */
    List<CustomTrainingInfoStatistics> queryGenderByTrainingId(@Param("trainingId") String trainingId);

    /**
     * 人群特征
     *
     * @param trainingId
     *
     * @return
     */
    List<CustomTrainingInfoStatistics> queryByTrainingId(@Param("trainingId") String trainingId);

    /**
     * 统计每个活动报名者中的男女人数
     *
     * @return
     */
    List<TrainingAudienceCount> countGender();

    /**
     * 插入每个活动中的男女比例
     *
     * @param genderAnalysis
     */
    void insertBatch(@Param("genderAnalysis") List<TrainingAudienceCount> genderAnalysis);

}
